package com.hue.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*
    通过配置类来配置服务网关
 */
@Configuration
public class RouteConfig {
    @Bean
    public RouteLocator getRouteLocator(RouteLocatorBuilder builder){
        RouteLocatorBuilder.Builder routes=builder.routes();
        routes.route("payment_route3",r->r.path("/baidu").uri("http://www.baidu.com")).build();
        return routes.build();
    }
}
